<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="活动标题" prop="title">
        <el-input v-model="queryParams.title" placeholder="请输入活动标题" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动类型，读取字典配置，新手局、比赛等" prop="type">
        <el-select v-model="queryParams.type" placeholder="请选择活动类型，读取字典配置，新手局、比赛等" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="活动报名开始时间" prop="signStartTime">
        <el-date-picker v-model="queryParams.signStartTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="活动报名结束时间" prop="signEndTime">
        <el-date-picker v-model="queryParams.signEndTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="活动封面图片地址" prop="coverPic">
        <el-input v-model="queryParams.coverPic" placeholder="请输入活动封面图片地址" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动开始时间" prop="startTime">
        <el-date-picker v-model="queryParams.startTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="活动结束时间" prop="endTime">
        <el-date-picker v-model="queryParams.endTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="活动总人数限制" prop="totalNumber">
        <el-input v-model="queryParams.totalNumber" placeholder="请输入活动总人数限制" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动开始人员数量" prop="startNumber">
        <el-input v-model="queryParams.startNumber" placeholder="请输入活动开始人员数量" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="每人提交人次限制" prop="submitNumber">
        <el-input v-model="queryParams.submitNumber" placeholder="请输入每人提交人次限制" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动排队人数限制" prop="lineNumber">
        <el-input v-model="queryParams.lineNumber" placeholder="请输入活动排队人数限制" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="收款商户号" prop="posNo">
        <el-input v-model="queryParams.posNo" placeholder="请输入收款商户号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动形式：线上、线下" prop="actForm">
        <el-input v-model="queryParams.actForm" placeholder="请输入活动形式：线上、线下" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动地址，定位" prop="actAddress">
        <el-input v-model="queryParams.actAddress" placeholder="请输入活动地址，定位" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动可见权限，1.管理员可见；2.任何人可见；3.已提交人可见" prop="actViewAuthority">
        <el-input v-model="queryParams.actViewAuthority" placeholder="请输入活动可见权限，1.管理员可见；2.任何人可见；3.已提交人可见" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动分享权限，1.不限制. 2.参与人能转发;3.仅限发起人、管理员分享按钮。3.发起人、管理员分享小程序卡片" prop="actShareAuthority">
        <el-input v-model="queryParams.actShareAuthority" placeholder="请输入活动分享权限，1.不限制. 2.参与人能转发;3.仅限发起人、管理员分享按钮。3.发起人、管理员分享小程序卡片" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="取消管理：1. 提交后不允许自行取消；2.提交后可以取消；3. 提交后在规定时间点前可以取消" prop="cancelManage">
        <el-input v-model="queryParams.cancelManage" placeholder="请输入取消管理：1. 提交后不允许自行取消；2.提交后可以取消；3. 提交后在规定时间点前可以取消" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="取消截至时间点" prop="cancelTime">
        <el-date-picker v-model="queryParams.cancelTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="报名后是否可修改: 1. 可以自行修改.2. 不可以修改" prop="editManage">
        <el-input v-model="queryParams.editManage" placeholder="请输入报名后是否可修改: 1. 可以自行修改.2. 不可以修改" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动允许快速填写, 允许提交者初始之前填写过的信息" prop="quickFill">
        <el-input v-model="queryParams.quickFill" placeholder="请输入活动允许快速填写, 允许提交者初始之前填写过的信息" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="提交后显示内容：1.什么都不显示；2.人数、头像和昵称;3.人数和头像;4.人数" prop="submitListShow">
        <el-input v-model="queryParams.submitListShow" placeholder="请输入提交后显示内容：1.什么都不显示；2.人数、头像和昵称;3.人数和头像;4.人数" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="提交前显示, 后续建表存内容模板" prop="submitBeforeShow">
        <el-input v-model="queryParams.submitBeforeShow" placeholder="请输入提交前显示, 后续建表存内容模板" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="提交后显示, 后续建表存内容模板" prop="submitAfterShow">
        <el-input v-model="queryParams.submitAfterShow" placeholder="请输入提交后显示, 后续建表存内容模板" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动发起人显示内容，后续建表存内容模板，此字段存模板id" prop="sponsorShow">
        <el-input v-model="queryParams.sponsorShow" placeholder="请输入活动发起人显示内容，后续建表存内容模板，此字段存模板id" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动费用" prop="actFee">
        <el-input v-model="queryParams.actFee" placeholder="请输入活动费用" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="会员优惠价格" prop="actMemberFee">
        <el-input v-model="queryParams.actMemberFee" placeholder="请输入会员优惠价格" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="球员优惠价格" prop="actTeamFee">
        <el-input v-model="queryParams.actTeamFee" placeholder="请输入球员优惠价格" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="收费类型，1.统一收费，2. 多项目收费. " prop="feeType">
        <el-select v-model="queryParams.feeType" placeholder="请选择收费类型，1.统一收费，2. 多项目收费. " clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="是否aa收费，1. 固定金额收费，2. aa收费，先固定金额收，后续人多退款" prop="feeIsAa">
        <el-input v-model="queryParams.feeIsAa" placeholder="请输入是否aa收费，1. 固定金额收费，2. aa收费，先固定金额收，后续人多退款" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="提交人限制：1.所有人. 2. 仅限会员. 3.仅限球员. 4. 黑名单限制" prop="submitAuthority">
        <el-input v-model="queryParams.submitAuthority" placeholder="请输入提交人限制：1.所有人. 2. 仅限会员. 3.仅限球员. 4. 黑名单限制" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="已提交人数" prop="signCount">
        <el-input v-model="queryParams.signCount" placeholder="请输入已提交人数" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="活动发起人id" prop="sponsorId">
        <el-input v-model="queryParams.sponsorId" placeholder="请输入活动发起人id" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                   v-hasPermi="['dt:activity:create']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
                   v-hasPermi="['dt:activity:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column label="活动标题" align="center" prop="title" />
      <el-table-column label="活动类型，读取字典配置，新手局、比赛等" align="center" prop="type" />
      <el-table-column label="活动内容说明" align="center" prop="content" />
      <el-table-column label="活动报名开始时间" align="center" prop="signStartTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.signStartTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="活动报名结束时间" align="center" prop="signEndTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.signEndTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="活动封面图片地址" align="center" prop="coverPic" />
      <el-table-column label="活动开始时间" align="center" prop="startTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="活动结束时间" align="center" prop="endTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.endTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="活动总人数限制" align="center" prop="totalNumber" />
      <el-table-column label="活动开始人员数量" align="center" prop="startNumber" />
      <el-table-column label="每人提交人次限制" align="center" prop="submitNumber" />
      <el-table-column label="活动排队人数限制" align="center" prop="lineNumber" />
      <el-table-column label="收款商户号" align="center" prop="posNo" />
      <el-table-column label="活动形式：线上、线下" align="center" prop="actForm" />
      <el-table-column label="活动地址，定位" align="center" prop="actAddress" />
      <el-table-column label="活动可见权限，1.管理员可见；2.任何人可见；3.已提交人可见" align="center" prop="actViewAuthority" />
      <el-table-column label="活动分享权限，1.不限制. 2.参与人能转发;3.仅限发起人、管理员分享按钮。3.发起人、管理员分享小程序卡片" align="center" prop="actShareAuthority" />
      <el-table-column label="取消管理：1. 提交后不允许自行取消；2.提交后可以取消；3. 提交后在规定时间点前可以取消" align="center" prop="cancelManage" />
      <el-table-column label="取消截至时间点" align="center" prop="cancelTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.cancelTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="报名后是否可修改: 1. 可以自行修改.2. 不可以修改" align="center" prop="editManage" />
      <el-table-column label="活动允许快速填写, 允许提交者初始之前填写过的信息" align="center" prop="quickFill" />
      <el-table-column label="提交后显示内容：1.什么都不显示；2.人数、头像和昵称;3.人数和头像;4.人数" align="center" prop="submitListShow" />
      <el-table-column label="提交前显示, 后续建表存内容模板" align="center" prop="submitBeforeShow" />
      <el-table-column label="提交后显示, 后续建表存内容模板" align="center" prop="submitAfterShow" />
      <el-table-column label="活动发起人显示内容，后续建表存内容模板，此字段存模板id" align="center" prop="sponsorShow" />
      <el-table-column label="活动费用" align="center" prop="actFee" />
      <el-table-column label="会员优惠价格" align="center" prop="actMemberFee" />
      <el-table-column label="球员优惠价格" align="center" prop="actTeamFee" />
      <el-table-column label="收费类型，1.统一收费，2. 多项目收费. " align="center" prop="feeType" />
      <el-table-column label="是否aa收费，1. 固定金额收费，2. aa收费，先固定金额收，后续人多退款" align="center" prop="feeIsAa" />
      <el-table-column label="提交人限制：1.所有人. 2. 仅限会员. 3.仅限球员. 4. 黑名单限制" align="center" prop="submitAuthority" />
      <el-table-column label="已提交人数" align="center" prop="signCount" />
      <el-table-column label="活动发起人id" align="center" prop="sponsorId" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                     v-hasPermi="['dt:activity:update']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                     v-hasPermi="['dt:activity:delete']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

    <!-- 对话框(添加 / 修改) -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="活动标题" prop="title">
          <el-input v-model="form.title" placeholder="请输入活动标题" />
        </el-form-item>
        <el-form-item label="活动类型，读取字典配置，新手局、比赛等" prop="type">
          <el-select v-model="form.type" placeholder="请选择活动类型，读取字典配置，新手局、比赛等">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="活动内容说明">
          <editor v-model="form.content" :min-height="192"/>
        </el-form-item>
        <el-form-item label="活动报名开始时间" prop="signStartTime">
          <el-date-picker clearable v-model="form.signStartTime" type="date" value-format="timestamp" placeholder="选择活动报名开始时间" />
        </el-form-item>
        <el-form-item label="活动报名结束时间" prop="signEndTime">
          <el-date-picker clearable v-model="form.signEndTime" type="date" value-format="timestamp" placeholder="选择活动报名结束时间" />
        </el-form-item>
        <el-form-item label="活动封面图片地址" prop="coverPic">
          <el-input v-model="form.coverPic" placeholder="请输入活动封面图片地址" />
        </el-form-item>
        <el-form-item label="活动开始时间" prop="startTime">
          <el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择活动开始时间" />
        </el-form-item>
        <el-form-item label="活动结束时间" prop="endTime">
          <el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择活动结束时间" />
        </el-form-item>
        <el-form-item label="活动总人数限制" prop="totalNumber">
          <el-input v-model="form.totalNumber" placeholder="请输入活动总人数限制" />
        </el-form-item>
        <el-form-item label="活动开始人员数量" prop="startNumber">
          <el-input v-model="form.startNumber" placeholder="请输入活动开始人员数量" />
        </el-form-item>
        <el-form-item label="每人提交人次限制" prop="submitNumber">
          <el-input v-model="form.submitNumber" placeholder="请输入每人提交人次限制" />
        </el-form-item>
        <el-form-item label="活动排队人数限制" prop="lineNumber">
          <el-input v-model="form.lineNumber" placeholder="请输入活动排队人数限制" />
        </el-form-item>
        <el-form-item label="收款商户号" prop="posNo">
          <el-input v-model="form.posNo" placeholder="请输入收款商户号" />
        </el-form-item>
        <el-form-item label="活动形式：线上、线下" prop="actForm">
          <el-input v-model="form.actForm" placeholder="请输入活动形式：线上、线下" />
        </el-form-item>
        <el-form-item label="活动地址，定位" prop="actAddress">
          <el-input v-model="form.actAddress" placeholder="请输入活动地址，定位" />
        </el-form-item>
        <el-form-item label="活动可见权限，1.管理员可见；2.任何人可见；3.已提交人可见" prop="actViewAuthority">
          <el-input v-model="form.actViewAuthority" placeholder="请输入活动可见权限，1.管理员可见；2.任何人可见；3.已提交人可见" />
        </el-form-item>
        <el-form-item label="活动分享权限，1.不限制. 2.参与人能转发;3.仅限发起人、管理员分享按钮。3.发起人、管理员分享小程序卡片" prop="actShareAuthority">
          <el-input v-model="form.actShareAuthority" placeholder="请输入活动分享权限，1.不限制. 2.参与人能转发;3.仅限发起人、管理员分享按钮。3.发起人、管理员分享小程序卡片" />
        </el-form-item>
        <el-form-item label="取消管理：1. 提交后不允许自行取消；2.提交后可以取消；3. 提交后在规定时间点前可以取消" prop="cancelManage">
          <el-input v-model="form.cancelManage" placeholder="请输入取消管理：1. 提交后不允许自行取消；2.提交后可以取消；3. 提交后在规定时间点前可以取消" />
        </el-form-item>
        <el-form-item label="取消截至时间点" prop="cancelTime">
          <el-date-picker clearable v-model="form.cancelTime" type="date" value-format="timestamp" placeholder="选择取消截至时间点" />
        </el-form-item>
        <el-form-item label="报名后是否可修改: 1. 可以自行修改.2. 不可以修改" prop="editManage">
          <el-input v-model="form.editManage" placeholder="请输入报名后是否可修改: 1. 可以自行修改.2. 不可以修改" />
        </el-form-item>
        <el-form-item label="活动允许快速填写, 允许提交者初始之前填写过的信息" prop="quickFill">
          <el-input v-model="form.quickFill" placeholder="请输入活动允许快速填写, 允许提交者初始之前填写过的信息" />
        </el-form-item>
        <el-form-item label="提交后显示内容：1.什么都不显示；2.人数、头像和昵称;3.人数和头像;4.人数" prop="submitListShow">
          <el-input v-model="form.submitListShow" placeholder="请输入提交后显示内容：1.什么都不显示；2.人数、头像和昵称;3.人数和头像;4.人数" />
        </el-form-item>
        <el-form-item label="提交前显示, 后续建表存内容模板" prop="submitBeforeShow">
          <el-input v-model="form.submitBeforeShow" placeholder="请输入提交前显示, 后续建表存内容模板" />
        </el-form-item>
        <el-form-item label="提交后显示, 后续建表存内容模板" prop="submitAfterShow">
          <el-input v-model="form.submitAfterShow" placeholder="请输入提交后显示, 后续建表存内容模板" />
        </el-form-item>
        <el-form-item label="活动发起人显示内容，后续建表存内容模板，此字段存模板id" prop="sponsorShow">
          <el-input v-model="form.sponsorShow" placeholder="请输入活动发起人显示内容，后续建表存内容模板，此字段存模板id" />
        </el-form-item>
        <el-form-item label="活动费用" prop="actFee">
          <el-input v-model="form.actFee" placeholder="请输入活动费用" />
        </el-form-item>
        <el-form-item label="会员优惠价格" prop="actMemberFee">
          <el-input v-model="form.actMemberFee" placeholder="请输入会员优惠价格" />
        </el-form-item>
        <el-form-item label="球员优惠价格" prop="actTeamFee">
          <el-input v-model="form.actTeamFee" placeholder="请输入球员优惠价格" />
        </el-form-item>
        <el-form-item label="收费类型，1.统一收费，2. 多项目收费. " prop="feeType">
          <el-select v-model="form.feeType" placeholder="请选择收费类型，1.统一收费，2. 多项目收费. ">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="是否aa收费，1. 固定金额收费，2. aa收费，先固定金额收，后续人多退款" prop="feeIsAa">
          <el-input v-model="form.feeIsAa" placeholder="请输入是否aa收费，1. 固定金额收费，2. aa收费，先固定金额收，后续人多退款" />
        </el-form-item>
        <el-form-item label="提交人限制：1.所有人. 2. 仅限会员. 3.仅限球员. 4. 黑名单限制" prop="submitAuthority">
          <el-input v-model="form.submitAuthority" placeholder="请输入提交人限制：1.所有人. 2. 仅限会员. 3.仅限球员. 4. 黑名单限制" />
        </el-form-item>
        <el-form-item label="已提交人数" prop="signCount">
          <el-input v-model="form.signCount" placeholder="请输入已提交人数" />
        </el-form-item>
        <el-form-item label="活动发起人id" prop="sponsorId">
          <el-input v-model="form.sponsorId" placeholder="请输入活动发起人id" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { createActivity, updateActivity, deleteActivity, getActivity, getActivityPage, exportActivityExcel } from "@/api/dt/activity";
import Editor from '@/components/Editor';

export default {
  name: "Activity",
  components: {
    Editor,
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 活动列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        title: null,
        type: null,
        content: null,
        signStartTime: [],
        signEndTime: [],
        coverPic: null,
        startTime: [],
        endTime: [],
        totalNumber: null,
        startNumber: null,
        submitNumber: null,
        lineNumber: null,
        posNo: null,
        actForm: null,
        actAddress: null,
        actViewAuthority: null,
        actShareAuthority: null,
        cancelManage: null,
        cancelTime: [],
        editManage: null,
        quickFill: null,
        submitListShow: null,
        submitBeforeShow: null,
        submitAfterShow: null,
        sponsorShow: null,
        actFee: null,
        actMemberFee: null,
        actTeamFee: null,
        feeType: null,
        feeIsAa: null,
        submitAuthority: null,
        signCount: null,
        sponsorId: null,
        createTime: [],
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 执行查询
      getActivityPage(this.queryParams).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        title: undefined,
        type: undefined,
        content: undefined,
        signStartTime: undefined,
        signEndTime: undefined,
        coverPic: undefined,
        startTime: undefined,
        endTime: undefined,
        totalNumber: undefined,
        startNumber: undefined,
        submitNumber: undefined,
        lineNumber: undefined,
        posNo: undefined,
        actForm: undefined,
        actAddress: undefined,
        actViewAuthority: undefined,
        actShareAuthority: undefined,
        cancelManage: undefined,
        cancelTime: undefined,
        editManage: undefined,
        quickFill: undefined,
        submitListShow: undefined,
        submitBeforeShow: undefined,
        submitAfterShow: undefined,
        sponsorShow: undefined,
        actFee: undefined,
        actMemberFee: undefined,
        actTeamFee: undefined,
        feeType: undefined,
        feeIsAa: undefined,
        submitAuthority: undefined,
        signCount: undefined,
        sponsorId: undefined,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加活动";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      getActivity(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改活动";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (!valid) {
          return;
        }
        // 修改的提交
        if (this.form.id != null) {
          updateActivity(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.getList();
          });
          return;
        }
        // 添加的提交
        createActivity(this.form).then(response => {
          this.$modal.msgSuccess("新增成功");
          this.open = false;
          this.getList();
        });
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
      this.$modal.confirm('是否确认删除活动编号为"' + id + '"的数据项?').then(function() {
          return deleteActivity(id);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = {...this.queryParams};
      params.pageNo = undefined;
      params.pageSize = undefined;
      this.$modal.confirm('是否确认导出所有活动数据项?').then(() => {
          this.exportLoading = true;
          return exportActivityExcel(params);
        }).then(response => {
          this.$download.excel(response, '活动.xls');
          this.exportLoading = false;
        }).catch(() => {});
    }
  }
};
</script>
